﻿<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:tb="http://www.hardcodet.net/taskbar"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
	xmlns:huddled="http://schemas.huddledmasses.org/wpf"
	xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
	x:Class="CG.SpotifyControl.MainWindow" 
	xmlns:controller="clr-namespace:CG.SpotifyControl.Controller"
	xmlns:ctrls="clr-namespace:CG.SpotifyControl.Controls"
	Height="21" 
	Width="251" 
	ResizeMode="NoResize" 
	WindowStyle="None" 
	Topmost="True" 
	ShowInTaskbar="False" 
	d:DataContext="{d:DesignInstance {x:Type controller:SpotifyController}}"
	Closing="Window_Closing"
	MouseLeftButtonDown="Window_MouseLeftButtonDown"
	Background="{x:Null}"
	AllowsTransparency="True"
	Title="{StaticResource ApplicationName}">

	<huddled:NativeBehaviors.Behaviors>
		<huddled:SnapToBehavior SnapDistance="20,20,20,20" />
	</huddled:NativeBehaviors.Behaviors>

	<Grid Margin="0" IsEnabled="{Binding Path=IsSpotifyRunning}">
		<tb:TaskbarIcon
			x:Name="NotifyIcon"
			IconSource="{StaticResource ApplicationIcon}"
			ToolTipText="{StaticResource ApplicationName}" Margin="0,0,86,-5" d:IsLocked="True">
			<tb:TaskbarIcon.ContextMenu>
				<ContextMenu>
					<MenuItem x:Name="menuSettings" Header="{StaticResource MenuSettings}" Click="MenuItem_Click" />
					<MenuItem x:Name="menuExit" Header="{StaticResource MenuExit}" Click="MenuItem_Click" />
				</ContextMenu>
			</tb:TaskbarIcon.ContextMenu>
		</tb:TaskbarIcon>
		<Rectangle x:Name="BG" RadiusX="3" RadiusY="3" StrokeThickness="2" d:IsLocked="True">
			<Rectangle.Stroke>
				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
					<LinearGradientBrush.RelativeTransform>
						<TransformGroup>
							<ScaleTransform CenterX="0.5" CenterY="0.5"/>
							<SkewTransform CenterX="0.5" CenterY="0.5"/>
							<RotateTransform Angle="-30" CenterX="0.5" CenterY="0.5"/>
							<TranslateTransform/>
						</TransformGroup>
					</LinearGradientBrush.RelativeTransform>
					<GradientStop Color="#FF787878" Offset="0"/>
					<GradientStop Color="#FF464646" Offset="1"/>
				</LinearGradientBrush>
			</Rectangle.Stroke>
			<Rectangle.Fill>
				<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
					<GradientStop Color="#FF606060" Offset="0"/>
					<GradientStop Color="#FF4E4E4E" Offset="1"/>
				</LinearGradientBrush>
			</Rectangle.Fill>
		</Rectangle>
		<TextBlock Margin="60,2,2,2" x:Name="artisttrack" Background="#00000000" Padding="0" VerticalAlignment="Center" FontSize="10.667" FontFamily="Tahoma" Foreground="#FFDDDDDD" DataContext="{Binding TrackInfos}" TextTrimming="CharacterEllipsis">
			<TextBlock.Text>
				<MultiBinding StringFormat="{}{0} - {1}">
					<Binding Path="ArtistName" FallbackValue="Artist"/>
					<Binding Path="TrackName" FallbackValue="Track"/>
				</MultiBinding>
			</TextBlock.Text>
		</TextBlock>
		<ctrls:ToggleButtonTwoStates x:Name="PlayPause" HorizontalAlignment="Left" Margin="19,2,0,2" Template="{StaticResource ToggleButtonAction}" Width="17" IsChecked="{Binding Path=IsPlaying}" ButtonStateChecked="{DynamicResource PauseGlyph}" ButtonStateUnchecked="{DynamicResource PlayGlyph}" />
		<Button x:Name="Previous" Template="{StaticResource ButtonAction}" HorizontalAlignment="Left" Margin="5,4,0,4" Width="13" Height="13" Content="{StaticResource PreviousGlyph}" Command="{Binding Path=Commands}" CommandParameter="{x:Static controller:CommandType.PreviousTrack}" />
		<Button x:Name="Next" Template="{StaticResource ButtonAction}" HorizontalAlignment="Left" Margin="37,4,0,4" Width="13" Height="13" Content="{StaticResource NextGlyph}" Command="{Binding Path=Commands}" CommandParameter="{x:Static controller:CommandType.NextTrack}" />
	</Grid>
</Window>


